<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8" />
<script src="webjars/jquery/jquery.min.js"></script>
<script src="webjars/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.min.css" />
</head>
<script type="text/javascript">
	$(document).ready(function() {
		//登录
		$(':button').click(function() {
              var username = $(this).parent().parent().prev().prev().text();
              if($(this).text() == '解封'){
            	  $.post("/dojiefeng", {
        				username : username,
        			}, function(data, status) {
        				if (data.status == "success") {
        					$(location).attr("href", "/search");
        				} else {
        					$(location).attr("href", "/search");
        				}
        			});
              }else{
            	  $.post("/dofenghao", {
      				username : username,
      			}, function(data, status) {
      				if (data.status == "success") {
      					$(location).attr("href", "/search?ok=yes");
      				} else {
      					$(location).attr("href", "/search");
      				}
      			});
              }
		});
	});
</script>
<body>
	<div class="container">
		<center>
			<h1>用户列表</h1>
			<table border="1">
				<tr>
					<th>用户名</th>
					<th>密码</th>
					<th>执行操作</th>
				</tr>
				<tr th:each="user:${users}">
					<td th:text="${user.username}"/>
					<td th:text="${user.password}"/>
					<td><center><button class="btn-primary btn-sm disabled" th:text="${user.dosome}"></button></center></td>
				</tr>
			</table>
		</center>
	</div>
</body>
</html>
